import {
    BaseEntity,
    PrimaryGeneratedColumn,
    CreateDateColumn,
    UpdateDateColumn,
    DeleteDateColumn,
} from 'typeorm';

export class CommonEntity extends BaseEntity {
    @PrimaryGeneratedColumn({
        type: 'int',
        name: 'id',
        comment: '主键id',
    })
    id: number;

    @CreateDateColumn({
        type: 'timestamp',
        nullable: false,
        name: 'created_at',
        comment: '创建时间',
    })
    createdAt: Date;

    @UpdateDateColumn({
        type: 'timestamp',
        nullable: false,
        name: 'updated_at',
        comment: '更新时间',
    })
    updatedAt: Date;

    @DeleteDateColumn({
        type: 'timestamp',
        nullable: false,
        name: 'deleted_at',
        select: false,
        comment: '软删除时间',
    })
    deletedAt: Date;
}
